package com.java.zhuiyun.api.member_manager_pc.mapper;

import com.java.zhuiyun.api.course_pc.entity.Course;
import com.java.zhuiyun.api.member_manager_pc.entity.Orders;
import com.java.zhuiyun.api.order.entity.FrontDeskUser;
import com.java.zhuiyun.api.recommendedCourse.model.TeacherCourseModel;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @InterfaceName MemberManagerPcMapper
 * @Description TODO
 * @Author wuwan
 * @Date 2023/8/29 8:30
 **/
@Mapper
public interface MemberManagerPcMapper {
    /*
    * @Author wuwan
    * @Description 精选好课
    * @Date 2023/8/29 10:02
    * @Return
    * @param null
    */
    @Select("SELECT * FROM course c, teacher t WHERE c.del_flag = 0  AND c.teacher_id = t.id AND pay_type = 1 ORDER BY c.course_click DESC LIMIT 6")
    List<TeacherCourseModel> randonFour();

    /*
    * @Author wuwan
    * @Description 用户订单信息
    * @Date 2023/8/29 10:02
    * @Return
    * @param null
    */
    @Select(" <script>select * from orders where user_id = #{uid} and del_flag = 0 " +
            " <if test='orderStatus!=null'>and order_status like concat('%',#{orderStatus},'%') </if>" +
            " </script>")
    List<Orders> getUserCourse(Integer uid,Integer orderStatus);

    /*
     * @Author wuwan
     * @Description 查询用户现有课程
     * @Date 2023/8/23 19:16
     * @Return
     * @param null
     */
    @Select("select purchase,front_desk_name from front_desk_user where id=#{uid};")
    FrontDeskUser getPurchasedCourse(Integer uid);

    @Select("select * from course where id=#{cid}")
    Course getPurchased(Integer cid);

}
